 //Basic password checks
 //proper format checks will be on server time 

 //basic password check
 function checkPassword(element) 
{
	var pass = document.getElementById("password");//get password element
	if( pass.value == "" ) //if empty
	{
		alert("Password is blank");//alert
		pass.focus();//set focus
		return false;//don't submit the form
	} 
	return true;
}

//check username and password
//password needs to have >5 characters
//used by: login, add employee
function checkUsernamePassword(element) 
{
	var uid = document.getElementById("userid");//get id
	var pass = document.getElementById("password");//get pass
	if( uid.value == "" ) //if id is null
	{
		alert("User ID is blank");//alert and don't return
		uid.focus();
		return false;
	}
	if( pass.value.length < 5 )//if password entered is less that 5 characters
	{
		alert("Passwords must be more than 5 characters");//alert and don't submit
		pass.value="";//reset pass
		return false;
	}
		return true;
}

//change password
function checkPasswordMatch() 
{
	var pass1 = document.getElementById("new_pass1");//get password 1
	var pass2 = document.getElementById("new_pass2");//get password 2
	if( pass1.value == "" ) //if null, alert and return false
	{
		alert("Your password cannot be blank");
		pass1.focus();
		return false;
	}
	if( pass1.value.length < 5 )//if length is less than 5, alert and redutrn false
	{
		alert("Passwords must be more than 5 characters");
		pass1.value="";
		pass2.value="";//reset values
		return false;
	}
	if( pass1.value != pass2.value ) //if passwords don't match
	{
		alert("The two passwords you entered do not match");//alert
		pass1.value="";//clear both passwords
		pass2.value="";
		pass1.focus();
		return false;
	}
	return true;
}
